const mysql = require('mysql');

// 1.根据用户名和密码创建数据库连接
// 2.执行sql语句
// 3.解析数据库返回的结果

const connection = mysql.createConnection({
    host: 'localhost',
    port: 3306,
    user: 'root',
    password: 'czq123456',
    database: 'demo'
})

connection.connect();

connection.query('select * from emp', function (err, result, fields) {
    if (err) throw err;
    console.log(result)
})

connection.end();